package com.denlaku.longan.service.impl;

import com.denlaku.longan.anno.RequiredTx;
import com.denlaku.longan.repository.LinkageAimRepository;
import com.denlaku.longan.service.LinkageAimService;
import com.denlaku.longan.vo.LinkageAim;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author tianx
 */
@Service
public class LinkageAimServiceImpl implements LinkageAimService {
    @Autowired
    private LinkageAimRepository linkageAimRepository;

    @Override
    @RequiredTx
    public void batchAdd(List<LinkageAim> aims) {
        if (CollectionUtils.isNotEmpty(aims)) {
            linkageAimRepository.batchAdd(aims);
        }
    }

    @Override
    @RequiredTx
    public void delete(Long tenantId, List<Long> componentIds) {
        linkageAimRepository.delete(tenantId, componentIds);
    }

    @Override
    public List<LinkageAim> list(Long tenantId, List<Long> componentIds) {
        return linkageAimRepository.list(tenantId, componentIds);
    }

}
